﻿package frEngine.loaders.particleSub
{
    import frEngine.loaders.particleSub.particleInstance.*;

    public class PlaneEmitter extends EmitterObject
    {
        private var _H:Number = 0;
        private var _W:Number = 0;
        private var dx:Number;
        private var dz:Number;
        private var _isRandom:Boolean = true;
        private var _totalNum:uint = 0;

        public function PlaneEmitter(param1:Number, param2:Number, param3:String, param4:String, param5:Boolean, param6:uint)
        {
            this._W = param1;
            this._H = param2;
            this.dx = this._W / 2;
            this.dz = this._H / 2;
            this._totalNum = param6;
            this._isRandom = param5;
            super(param3, param4);
            return;
        }// end function

        override public function get meshData() : MeshBase
        {
            if (!_meshData && !hasDisposed)
            {
                _meshData = new PlaneParticle(this._W, this._H, "+xz");
            }
            return _meshData;
        }// end function

        override protected function processAxis(param1:int) : void
        {
            _vect3d.x = 0;
            _vect3d.z = 0;
            return;
        }// end function

        override protected function processCurve(param1:int) : void
        {
            var _loc_2:Number = NaN;
            var _loc_3:Number = NaN;
            if (this._isRandom)
            {
                _loc_2 = randnomArr0[param1];
                _loc_3 = randnomArr1[param1];
                _vect3d.x = this._W * 0.5 - this._W * _loc_2;
                _vect3d.z = this._H * 0.5 - this._H * _loc_3;
            }
            else
            {
                _vect3d.x = this._W * param1 / this._totalNum - this._W * 0.5;
                _vect3d.z = this._H * 0.5;
            }
            return;
        }// end function

        override protected function processEdage(param1:int) : void
        {
            var _loc_2:* = randnomArr0[param1];
            var _loc_3:* = randnomArr1[param1];
            var _loc_4:* = randnomArr2[param1];
            if (_loc_2 < 0.5)
            {
                _vect3d.x = this._W * 0.5 - this._W * _loc_3;
                _vect3d.z = _loc_4 < 0.5 ? (-this.dz) : (this.dz);
            }
            else
            {
                _vect3d.z = this._H * 0.5 - this._H * _loc_3;
                _vect3d.x = _loc_4 < 0.5 ? (-this.dx) : (this.dx);
            }
            return;
        }// end function

        override protected function processVertex(param1:int) : void
        {
            var _loc_2:* = randnomArr0[param1];
            var _loc_3:* = randnomArr1[param1];
            _vect3d.x = _loc_2 < 0.5 ? (-this.dx) : (this.dx);
            _vect3d.z = _loc_3 < 0.5 ? (-this.dz) : (this.dz);
            return;
        }// end function

        override protected function processVolume(param1:int) : void
        {
            this.processCurve(param1);
            return;
        }// end function

    }
}
